﻿using NB.MGJ.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NB.MGJ.Model
{
    /// <summary>
    /// 扫码记录
    /// </summary>
    public class ScanCodeHistory
    {
        /// <summary>
        ///ButtonId
        /// </summary>
        [Property("Key")]
        public int ID { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public int? UserId { get; set; }

        /// <summary>
        /// 扫描时间
        /// </summary>



        public DateTime ScanDate
        { get; set; }

        /// <summary>
        /// 扫码类型
        /// </summary>
        public int CodeType { get; set; }

        /// <summary>
        /// 码内容
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 唯一标识
        /// 原则上为微信OpenId
        /// 在某些情况下
        /// 该标识符自动填充32位GUID
        /// </summary>
        [NotMapped]
        private string uniqueidentifier;
        public string UniqueIdentifier
        {
            get
            {
                return uniqueidentifier == null ? Constant.GetGuid32: uniqueidentifier;
            }
            set
            {
                uniqueidentifier = value;
            }
        }

        public int ScanCount { get; set; }
    }
}
